package cn.kgc.fcm.dsbank.controller;

import cn.kgc.fcm.dsbank.dto.ResultDTO;
import cn.kgc.fcm.dsbank.entity.ProvinceCityDistrict;
import cn.kgc.fcm.dsbank.service.ProvinceCityDistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController //该类中的所有方法都会返回字符串，我们通常返回json
@RequestMapping("/city_district")
public class CityDistrictController {
    @Autowired
    private ProvinceCityDistrictService pds;

//    @ResponseBody
    @RequestMapping("/show_city_or_district/{pId}")
    public ResultDTO<List<ProvinceCityDistrict>> selectProviceCityDistrictByPid(@PathVariable Integer pId){
        ResultDTO<List<ProvinceCityDistrict>> cityOrDistriceResultDTO = pds.selectProvinceCityDistrictByPid(pId);
        return cityOrDistriceResultDTO;
    }
}
